Display report filters in module

Hi,

I have created a formal module to display few columns for reporting purposes. I then run a DXL script to collect data from various modules and display records as objects in the current (reporting) module. The DXL script, when run, loads a dialog box to allow users to filter data by selecting choices in a multi list. When click OK, the script retrieves relevant data and display as objects in the current module. This all works fine.

However, I would like to display the selection, made by the user on the dialog box, on the module somewhere using DXL scripts. When exported to Excel, the selections should be visible there too. Please advise if there is any way to achieve this using DXL scripts.

Thanks,
Mousam
Mousam - Wed Jun 01 21:03:48 EDT 2011

Re: Display report filters in module
SystemAdmin - Wed Jun 01 21:31:09 EDT 2011

Can you please provide more info as per the following:

"When click OK, the script retrieves relevant data and display as objects in the current module"
When you say "retrieves relevant data" do you mean that the DXL script applies a filter to the objects in the moduule so that user only sees objects that match the selection they made in dialog box?

"I would like to display the selection, made by the user on the dialog box, on the module somewhere using DXL scripts
If you have answered "Yes" to my question above, does this statement mean that you now want to be able to export the visible filtered objects to Excel?

Paul Miller
Melbourne, Australia

Re: Display report filters in module
Mousam - Wed Jun 01 22:11:34 EDT 2011

SystemAdmin - Wed Jun 01 21:31:09 EDT 2011
Can you please provide more info as per the following:

"When click OK, the script retrieves relevant data and display as objects in the current module"
When you say "retrieves relevant data" do you mean that the DXL script applies a filter to the objects in the moduule so that user only sees objects that match the selection they made in dialog box?

"I would like to display the selection, made by the user on the dialog box, on the module somewhere using DXL scripts
If you have answered "Yes" to my question above, does this statement mean that you now want to be able to export the visible filtered objects to Excel?


Paul Miller
Melbourne, Australia

Hi Paul,

The DXL script gathers data from 2 other modules and display it in the current (reporting) module. So the script reads data from other modules, create objects in current module and populate its attribute values. The data read from the 2 modules is filtered (in the script) as per the selection made on the dialog box.

I can then export the reporting view as CSV and open it in Excel.

Thanks,
Mousam

Re: Display report filters in module
SystemAdmin - Thu Jun 02 01:36:16 EDT 2011

Mousam - Wed Jun 01 22:11:34 EDT 2011
Hi Paul,

The DXL script gathers data from 2 other modules and display it in the current (reporting) module. So the script reads data from other modules, create objects in current module and populate its attribute values. The data read from the 2 modules is filtered (in the script) as per the selection made on the dialog box.

I can then export the reporting view as CSV and open it in Excel.

Thanks,
Mousam

OK - I think I understand now - you can already export to Excel but you want to add the users multi list selection from the dialogue box to the module so that the users selection criteria can be included in the export to Excel.

Your code should already have a for-do loop to go through the currently selected items in the multiList DBE, so just add into that loop some code that adds each selected item plus a new line to a buffer. When all of the other objects have been created, then add one more object to the module with a copy of the contents of the buffer put into the Object Text attribute. You can be a little more fancy and insert a title line at the beginning of the buffer with something like "User Selected the Following" set to a bold font.

The DXL reference manual has a good example of a simple multiList DBE script that displays all of the attributes of a module in a multiList DBE, I've modified it (see below) so that it captures what the user has selected and then displays that in a new object created at the end of all of the other objects. Hope this is what you're after.
 

DB attrShow = create "Attributes" 
string attrNames[100] 
int noOfAttrs = 0 
string an 
 
if (null current Module) {
    ack "Please run this function from a module"
    halt
} 
 
for an in current Module do
    attrNames[noOfAttrs++] = an 
 
DBE attrList = multiList(attrShow, "Attributes:",10, attrNames, noOfAttrs) 
 
void printAttrs(DB box) {
    string attrName
    Buffer userSelectionList = create
    Object lastObj, newObj
    Module m = current
 
    setempty userSelectionList
    userSelectionList += "{\\b User Selected the Following:\n\n}"
 
    for attrName in attrList do {
      userSelectionList += attrName "\n"
    }
    lastObj = last(m)
    newObj = create lastObj
    newObj."Object Text" = richText(userSelectionList"")
    delete userSelectionList
} // printAttrs 
 
apply(attrShow, "Print", printAttrs) 
 
void clearSelection(DB box) {
    int i 
    for i in 0:noOfAttrs do
         set(attrList, i, false)
} // clearSelection 
 
apply(attrShow, "Clear", clearSelection) 
show attrShow

 

 


Paul Miller
Melbourne, Australia

 

 

Re: Display report filters in module
Mousam - Thu Jun 02 01:48:19 EDT 2011

SystemAdmin - Thu Jun 02 01:36:16 EDT 2011

OK - I think I understand now - you can already export to Excel but you want to add the users multi list selection from the dialogue box to the module so that the users selection criteria can be included in the export to Excel.

Your code should already have a for-do loop to go through the currently selected items in the multiList DBE, so just add into that loop some code that adds each selected item plus a new line to a buffer. When all of the other objects have been created, then add one more object to the module with a copy of the contents of the buffer put into the Object Text attribute. You can be a little more fancy and insert a title line at the beginning of the buffer with something like "User Selected the Following" set to a bold font.

The DXL reference manual has a good example of a simple multiList DBE script that displays all of the attributes of a module in a multiList DBE, I've modified it (see below) so that it captures what the user has selected and then displays that in a new object created at the end of all of the other objects. Hope this is what you're after.
 

DB attrShow = create "Attributes" 
string attrNames[100] 
int noOfAttrs = 0 
string an 
 
if (null current Module) {
    ack "Please run this function from a module"
    halt
} 
 
for an in current Module do
    attrNames[noOfAttrs++] = an 
 
DBE attrList = multiList(attrShow, "Attributes:",10, attrNames, noOfAttrs) 
 
void printAttrs(DB box) {
    string attrName
    Buffer userSelectionList = create
    Object lastObj, newObj
    Module m = current
 
    setempty userSelectionList
    userSelectionList += "{\\b User Selected the Following:\n\n}"
 
    for attrName in attrList do {
      userSelectionList += attrName "\n"
    }
    lastObj = last(m)
    newObj = create lastObj
    newObj."Object Text" = richText(userSelectionList"")
    delete userSelectionList
} // printAttrs 
 
apply(attrShow, "Print", printAttrs) 
 
void clearSelection(DB box) {
    int i 
    for i in 0:noOfAttrs do
         set(attrList, i, false)
} // clearSelection 
 
apply(attrShow, "Clear", clearSelection) 
show attrShow

 

 


Paul Miller
Melbourne, Australia

 

 

Thanks for the reply Paul. I really appreciate it.

Just wondering, if there is any way to display the selection in the module itself other than adding as an object. I tried creating module attribute of type text and setting its value in the script (selections were formatted as a comma separated string). But when I open module properties and have a look at the attribute its value is always blank. Is there something restrictive on setting module level attribute values?

Thanks,
Mousam

Re: Display report filters in module
SystemAdmin - Thu Jun 02 02:11:59 EDT 2011

Mousam - Thu Jun 02 01:48:19 EDT 2011
Thanks for the reply Paul. I really appreciate it.

Just wondering, if there is any way to display the selection in the module itself other than adding as an object. I tried creating module attribute of type text and setting its value in the script (selections were formatted as a comma separated string). But when I open module properties and have a look at the attribute its value is always blank. Is there something restrictive on setting module level attribute values?

Thanks,
Mousam

Shouldn't be a problem.

With respect the code I showed in my last post - I created a module Text type attribute named "User Selection".

Just after the line of code

newObj."Object Text" = richText(userSelectionList"")

 


I added the following

 

 

m."User Selection" = richText(userSelectionList"")


When I look at the module attribute "User Selection" - it has the user selection text as expected so I'm not sure why yours is blank.

Perhaps add a print statement in your code just before the line that sets the module attribute value - get the print statement to print the value of the text variable that your using to put into the module attribute and just check that it's not blank in the first place. If it is blank, then it's not a module attribute issue.

Also - just make sure in your code that the report module is set to be the current module before you write anything to it e.g. in my case, m = current. Although if you haven't done that already I would think that you would be experiencing other problems as well.

 

 

 


Paul Miller
Melbourne, Australia

 

 

Re: Display report filters in module
Mousam - Thu Jun 02 02:23:56 EDT 2011

SystemAdmin - Thu Jun 02 02:11:59 EDT 2011

Shouldn't be a problem.

With respect the code I showed in my last post - I created a module Text type attribute named "User Selection".

Just after the line of code

newObj."Object Text" = richText(userSelectionList"")

 


I added the following

 

 

m."User Selection" = richText(userSelectionList"")


When I look at the module attribute "User Selection" - it has the user selection text as expected so I'm not sure why yours is blank.

Perhaps add a print statement in your code just before the line that sets the module attribute value - get the print statement to print the value of the text variable that your using to put into the module attribute and just check that it's not blank in the first place. If it is blank, then it's not a module attribute issue.

Also - just make sure in your code that the report module is set to be the current module before you write anything to it e.g. in my case, m = current. Although if you haven't done that already I would think that you would be experiencing other problems as well.

 

 

 


Paul Miller
Melbourne, Australia

 

 

Hi Paul, you were right. When I was printing the selections individually it worked fine but the way I was appending the selections as comma separated string did not work properly.

This code was printing the value of str blank.

string s
string str = ""
for s in choiceSelections do
    str += s ", "
print str

 


This code worked.

 

 

 

string s
string str = ""
for s in choiceSelections do
    str = str + s ", "
print str



Thanks,
Mousam